*     *****************************************************************   *;
*     *****************************************************************   *; 
*   Date:          December 27, 2021                               	      *;
*   Authors:       Lisa Dellmuth and Jonas Tallberg				          *;   
*   Purpose: 	   Analyses for book Legitimacy Politics: Elite  		  *;
*    Communication and Public Opinion in Global Governance (CUP, 2023)    *;
*     ****************************************************************    *;
*     ****************************************************************    *;


*Figure 2.8

use "Leggov elite survey 19 sept 2019.dta", clear

*elite by elite type

tab country

sum confUN-confFIFA
recode confUN 1=0 2=0 3=1 4=1
recode confIMF 1=0 2=0 3=1 4=1
recode confICC 1=0 2=0 3=1 4=1
recode confNATO 1=0 2=0 3=1 4=1
recode confWB 1=0 2=0 3=1 4=1
recode confWHO 1=0 2=0 3=1 4=1
recode confWTO 1=0 2=0 3=1 4=1
recode confUNFCCC 1=0 2=0 3=1 4=1
recode confUNSC 1=0 2=0 3=1 4=1
recode confG20 1=0 2=0 3=1 4=1
recode confAU 1=0 2=0 3=1 4=1
recode confEU 1=0 2=0 3=1 4=1
recode confASEAN 1=0 2=0 3=1 4=1
recode confNAFTA 1=0 2=0 3=1 4=1
recode confMERCOSUR 1=0 2=0 3=1 4=1
recode confSCO 1=0 2=0 3=1 4=1
recode confgov 1=0 2=0 3=1 4=1

tab elitecat

collapse confUN-confG20 confgov, by(elitecat) 

egen confios = rowmean(confUN-confG20) // ignores missings
drop confUN-confG20

reshape long conf, i(elitecat) j(inst, string)
ed

drop if inst=="gov"

label define elite 1 "Party" 2 "Bureaucrats" 3 "Civil society" 4 "Media" 5 "Business" 6 "Research" 7 "MS rep's" ///
8 "IO officials", modify
label values elitecat elite 

set scheme plotplain

graph bar conf,over(elitecat, sort(1) descending) ///
ylabel(0 "0%" .20 "20%" .40 "40%" .60 "60%" .80 "80%" 1 "100%", labsize(small) angle(horizontal) ///
glcolor(gs14) gmax) bar(3, color(g2)) ytitle("% a great deal or quite a lot of confidence") ylabel(,gstyle(minor)) legend(off) 

    
 
